package com.hqyj.controller;


import com.hqyj.pojo.TbChargeDetail;
import com.hqyj.service.TbChargeDetailService;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * <p>
 * 收费名细表 前端控制器
 * </p>
 *
 * @author gp
 * @since 2021-09-26
 */
@RestController
@RequestMapping("/tb-charge-detail")
public class TbChargeDetailController {
    @Autowired
    TbChargeDetailService tbChargeDetailService;
    /**
    * @Author:YaoHaoHong
     * http://localhost:8080/tb-charge-detail/list
    * @Description:
    * @Date:2021/9/28 10:13
    */
    @GetMapping("/list")
    public HashMap<String,Object> list(TbChargeDetail tbChargeDetail){
        return tbChargeDetailService.list(tbChargeDetail);
    }
    /**
    * @Author:YaoHaoHong
     * http://localhost:8080/tb-charge-detail/update
    * @Description:
    * @Date:2021/9/28 10:13
    */
    @PutMapping(value = "/update",consumes = "application/json")
    public HashMap<String,Object> update(@RequestBody TbChargeDetail tbChargeDetail){
        return tbChargeDetailService.update(tbChargeDetail);
    }
    /**
    * @Author:YaoHaoHong
     * http://localhost:8080/tb-charge-detail/add
    * @Description:
    * @Date:2021/9/28 10:13
    */
    @PostMapping(value = "/add",consumes = "application/json")
    public HashMap<String,Object> insert(@RequestBody TbChargeDetail tbChargeDetail){
        return tbChargeDetailService.insert(tbChargeDetail);
    }
    /**
    * @Author:YaoHaoHong
     * http://localhost:8080/tb-charge-detail/del/?
    * @Description:
    * @Date:2021/9/28 10:14
    */
    @DeleteMapping("/del/{id}")
    public HashMap<String,Object> delete(@PathVariable Integer id){
        return tbChargeDetailService.delete(id);
    }

    /**
    * @Author:YaoHaoHong
    * @Description:
     * http://localhost:8080/tb-charge-detail/queryByName/?
    * @Date:2021/9/30 10:33
    */
    @GetMapping(value = "queryByName/{name}")
    public HashMap<String,Object> queryByName(@PathVariable String name){
        return tbChargeDetailService.queryByName(name);
    }
}

